const Router = require("koa-router");
const { APP_PREFIX } = require("../config/config.default");
const { auth, hadAdminPermission } = require("../middleware/auth.middleware");
const {
  validator,
  verifyNumberName,
} = require("../middleware/number.middleware");
const {
  create,
  update,
  remove,
  restore,
  findAll
} = require("../controller/number.controller");

const router = new Router({ prefix: `/${APP_PREFIX}/number` });

// 创建
router.post("/", auth, hadAdminPermission, validator, verifyNumberName, create);

// 修改
router.put("/:id", auth, hadAdminPermission, validator, update);

// 硬删除接口
// router.delete("/:id", auth,hadAdminPermission,remove);

// 下架
router.post("/:id/off", auth, hadAdminPermission, remove);

// 上架
router.post("/:id/on", auth, hadAdminPermission, restore);

// 列表
router.get("/",  findAll);


module.exports = router;
